1. /* sffberni.cpp by K.Tsuru */
  2. // function ID 7100 DRADIX
  3. /*****************************************************************
  4. SFraction class
  5. It provides the n-th Bernoulli's number Bn by use of TanCoeff(n).
  6. ******************************************************************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. SFraction BernNum(uint n){
  11. SLong den;
  12. if(n >= den.Radix()/2u) den.SetError(den.OUT_OF_RANGE,"BernNum", 7100);
  13. if(!n){ TanCoeff(0); return 0.0; } // free memory.
  14. SLong Tn2n = (2*n)*TanCoeff(n);
  15. den = Lpow(4, n); // den = 2^(2n)
  16. den = den*(den -1L);
  17. SFraction r(Tn2n, den);
  18. r.Reduce();
  19. return r;
  20. }

sffberni.cpp : last modifiled at 2008/12/04 15:52:00(648 bytes)
created at 2015/12/22 16:07:29
The creation time of this html file is 2016/09/13 19:56:38 (Tue Sep 13 19:56:38 2016).